﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CompanyBussiness;

namespace Website.admin.Control
{
    public partial class cSetting : System.Web.UI.UserControl
    {
        LanguagesManagement languageMana = new LanguagesManagement();
        CompanyBussiness.Language language;
        CompanyBussiness.TagTranslation tag;
        ServicesBasic serbasic = new ServicesBasic();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                LoadGrid();

                imgEmail.ImageUrl = serbasic.GetPicEmail().ContactCompany.ToString();
                imgContact.ImageUrl = serbasic.GetPicContact().ContactCompany.ToString();
            }
        }


        protected void LoadGrid()
        {
            GridViewListNick.DataSource = serbasic.GetListNick();
            GridViewListNick.DataBind();

            GridViewEmail.DataSource = serbasic.GetListRoom();
            GridViewEmail.DataBind();
        }


        protected void btnEdit_Command(object sender, CommandEventArgs e)
        {
            if (e.CommandName == "Edit")
            {
                Session[CONST.SESSION_CONTACT] = Convert.ToInt32(e.CommandArgument);
                try
                {

                    Response.Redirect("Administrator.aspx?" + CONST.ACTION + "=CreateContact&" + CONST.QUERYSTRING_CONTACT + "=" + int.Parse(Session[CONST.SESSION_CONTACT].ToString()));
                }
                catch (Exception)
                {

                }
            }
        }

        protected void btnChange_Command(object sender, CommandEventArgs e)
        {
            if (e.CommandName == "Change")
            {
                Session[CONST.SESSION_CONTACT] = Convert.ToInt32(e.CommandArgument);
                try
                {

                    Response.Redirect("Administrator.aspx?" + CONST.ACTION + "=CreateContact&" + CONST.QUERYSTRING_CONTACT + "=" + int.Parse(Session[CONST.SESSION_CONTACT].ToString()));
                }
                catch (Exception)
                {

                }
            }
        }
    }
}